package com.burges.net.dataStream.codeRuler.transform.MultiDataStream

import org.apache.flink.streaming.api.scala.{DataStream, StreamExecutionEnvironment, _}


/**
  * 创建人    BurgessLee 
  * 创建时间   2020/1/26 
  * 描述
  */
object UnionDemo {

	def main(args: Array[String]): Unit = {
		val environment = StreamExecutionEnvironment.getExecutionEnvironment
		//创建不同的数据集
		val dataStream1 = environment.fromElements(("a",3), ("d", 4), ("c", 2), ("c", 5), ("a", 5))
		val dataStream2 = environment.fromElements(("d",1), ("b", 3), ("s", 2), ("e", 5), ("a", 6))
		val dataStream3 = environment.fromElements(("a",3), ("d", 4), ("c", 2), ("c", 5), ("a", 5))
		//合并两个数据集
		val unionStream: DataStream[(String, Int)] = dataStream1.union(dataStream2)
		val allUnionStream: DataStream[(String, Int)] = dataStream1.union(dataStream2, dataStream3)

//		unionStream.print()
		allUnionStream.print()

		environment.execute("streaming union operator")
	}

}
